<template>
	<el-main>
        <el-card shadow="never" header="订单导入">
        <el-row>
            <el-col :lg="{span:9, offset: 9}">
                    <el-form :model="form" :rules="rules" :disabled="mode=='show'" ref="dialogForm" label-width="100px" label-position="left">
                        <el-form-item label="上传Excel" prop="order_status">
                            <sc-upload-file v-model="fileurl" :limit="3" tip="最多上传1个文件,单个文件不要超过10M,请上传xlsx/docx格式文件">
                                <el-button type="default" icon="el-icon-upload">上传</el-button>
                            </sc-upload-file>
                        </el-form-item>
          
   
                        <el-button type="primary" :loading="isSaveing" @click="submit()">立即导入</el-button>
                        
                    </el-form>
                    
            </el-col>
        </el-row>
    </el-card>
	</el-main>
</template>

<script>
	export default {
		data() {
			return {
                fileurl:'',
				//验证规则
				rules: {
					name: [
						{required: true, message: '请输入名称'}
					],
				}
			}
		},
		mounted() {

		},
		methods: {
			//表单提交方法
			submit(){
				this.$refs.dialogForm.validate(async (valid) => {
					if (valid) {
						this.isSaveing = true;
						var res = await this.$API.demo.goodscat_post.post(this.form);
						this.isSaveing = false;
						if(res.code == 200){
							this.$emit('success', this.form, this.mode)
							this.$message.success("操作成功")
						}else{
							this.$alert(res.message, "提示", {type: 'error'})
						}
					}
				})
			}
	 
		}
	}
</script>

<style>
</style>
